package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.domain.TtsAx;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.service.ITtsAxService;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 消控点位Controller
 * 
 * @author li
 * @date 2025-08-18
 */
@Api(tags = "天童寺消控点位数据")
@RestController
@RequestMapping("/system/ax")
public class TtsAxController extends BaseController
{
    @Autowired
    private ITtsAxService ttsAxService;

    /**
     * 查询消控点位列表
     */
    @GetMapping("/list")
    @ApiOperation("查询消控点位列表")
    public AjaxResult list(TtsAx ttsAx)
    {
        List<TtsAx> list = ttsAxService.selectTtsAxList(ttsAx);
        return success(list);
    }

    /**
     * 导出消控点位列表
     */
    @Log(title = "消控点位", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TtsAx ttsAx)
    {
        List<TtsAx> list = ttsAxService.selectTtsAxList(ttsAx);
        ExcelUtil<TtsAx> util = new ExcelUtil<TtsAx>(TtsAx.class);
        util.exportExcel(response, list, "消控点位数据");
    }

    /**
     * 获取消控点位详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(ttsAxService.selectTtsAxById(id));
    }

    /**
     * 新增消控点位
     */
    @Log(title = "消控点位", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TtsAx ttsAx)
    {
        return toAjax(ttsAxService.insertTtsAx(ttsAx));
    }

    /**
     * 修改消控点位
     */
    @Log(title = "消控点位", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TtsAx ttsAx)
    {
        return toAjax(ttsAxService.updateTtsAx(ttsAx));
    }

    /**
     * 删除消控点位
     */
    @Log(title = "消控点位", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(ttsAxService.deleteTtsAxByIds(ids));
    }

    /**
     * 获取首页消控点位分类统计信息
     */
    @GetMapping(value = "/pointType")
    public AjaxResult getPointType()
    {
        return success(ttsAxService.getPointType());
    }
    /**
     * 获取消防页面消控点位分类统计信息
     */
    @GetMapping(value = "/pointXfType")
    public AjaxResult getPointXfType()
    {
        return success(ttsAxService.getPointXfType());
    }

    /**
     * 获取消防页面消控点位所在位置分类统计信息消控设备列表
     */
    @GetMapping(value = "/pointByNameType")
    public AjaxResult getPointByNameType()
    {
        return success(ttsAxService.getPointByNameType());
    }

}
